As to the image coding process using transform/quantization, in order to encode so as to generate a target amount of coded data, a rate control method for adaptively switch a quantization scale based on the amount of coded data generated in the past is used. The rate control method of conventional technique intends for the amount of coded data to converge at a desired amount of coded data. Accordingly, it is not always guaranteed that the accumulated amount of coded data is converged within a target amount of coded data.
In one-pass coding, as a result of the coding process, the accumulated amount of coded data may be over the target amount of coded data. If an encoder is composed with hardware and if a size of a bit stream is previously defined, when the accumulated amount of coded data is over the target amount of coded data, it is a problem that the bit stream is failed.
A coding method for avoiding the failure of the stream buffer is disclosed. In this method, a minimum amount of coded data and a maximum amount of coded data are determined for one macro block. At a macro block, if the maximum amount of coded data is generated and if the stream buffer is failed, this macro block is encoded so as to generate the minimum amount of coded data.
In above-mentioned method, even if the maximum amount of coded data is generated from this block, the coding condition is switched by whether the stream buffer is failed or not. In general, the image quality is largely degraded by encoding so as to generate the minimum amount of coded data. Accordingly, the coding process by the minimum amount of coded data had better not be selected. On the other hand, in above-mentioned method, a margin of the maximum amount of coded data is equivalently reserved. As a result, it is a problem that the coding process by the minimum amount of coded data is apt to be selected.